home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / global_r.swf / scripts / __Packages / Chopper.as < prev    next >
Encoding:
Text File  |  2010-04-12  |  21.5 KB  |  722 lines

  1. class Chopper
  2. {
  3.    var refGame;
  4.    var bmpChopper;
  5.    var bmpBackRot;
  6.    var bmpTopRot;
  7.    var bmpExplode;
  8.    var bmpWheels;
  9.    var bmpTmp;
  10.    var bmpCanvas;
  11.    var width;
  12.    var height;
  13.    var acc;
  14.    var accMax;
  15.    var speed;
  16.    var position;
  17.    var bOnPlatform;
  18.    var screenPos;
  19.    var frame;
  20.    var backFrame;
  21.    var topFrame;
  22.    var frameExp;
  23.    var screenH;
  24.    var airDrag;
  25.    var rotation;
  26.    var maxRot;
  27.    var bShowWheels;
  28.    var frameWheels;
  29.    var fuel;
  30.    var aHostTaken;
  31.    var energy;
  32.    var bDestroyed;
  33.    var bShowExplosion;
  34.    var bTurn;
  35.    var turnDir;
  36.    var turnDelay;
  37.    var chafs;
  38.    var bChaf;
  39.    var chafDelay;
  40.    var bShot;
  41.    var shotDelay;
  42.    var cannonAngle;
  43.    var cannonAngleMin;
  44.    var cannonAngleMax;
  45.    var bAutoAim;
  46.    var aCannonPos;
  47.    var aTopPos;
  48.    var rope;
  49.    var ropePos;
  50.    var aBottom;
  51.    var ropeEndPos;
  52.    var bRopePress;
  53.    var bGodMode = false;
  54.    var maxChafs = 5;
  55.    var bFuelSnd = false;
  56.    var maxLoad = 5;
  57.    var unloadTime = 20;
  58.    function Chopper(newPos)
  59.    {
  60.       this.refGame = Game.getInstance();
  61.       this.bmpChopper = flash.display.BitmapData.loadBitmap("chopper");
  62.       this.bmpBackRot = flash.display.BitmapData.loadBitmap("backRot");
  63.       this.bmpTopRot = flash.display.BitmapData.loadBitmap("topRot");
  64.       this.bmpExplode = flash.display.BitmapData.loadBitmap("explosion0");
  65.       this.bmpWheels = flash.display.BitmapData.loadBitmap("chopper wheels");
  66.       this.bmpTmp = new flash.display.BitmapData(130,58);
  67.       this.bmpCanvas = Game.bmpChopper;
  68.       this.width = 130;
  69.       this.height = 53;
  70.       this.acc = new flash.geom.Point(0,0);
  71.       this.accMax = new flash.geom.Point(15,5);
  72.       this.speed = new flash.geom.Point(0,0);
  73.       this.position = newPos.clone();
  74.       this.position.y += 27;
  75.       this.bOnPlatform = false;
  76.       this.screenPos = new flash.geom.Point();
  77.       this.frame = 3;
  78.       this.backFrame = 1;
  79.       this.topFrame = 1;
  80.       this.frameExp = 0;
  81.       this.screenH = Game.screenH;
  82.       this.airDrag = 0.98;
  83.       this.rotation = 0;
  84.       this.maxRot = 0.5235987755982988;
  85.       this.bShowWheels = true;
  86.       this.frameWheels = 6;
  87.       this.fuel = 100;
  88.       this.aHostTaken = new Array();
  89.       this.energy = 5;
  90.       this.bDestroyed = false;
  91.       this.bShowExplosion = false;
  92.       this.bTurn = false;
  93.       this.turnDir = -1;
  94.       this.turnDelay = 0;
  95.       this.chafs = this.maxChafs;
  96.       this.bChaf = false;
  97.       this.chafDelay = 0;
  98.       this.bShot = false;
  99.       this.shotDelay = 0;
  100.       this.cannonAngle = 0;
  101.       this.cannonAngleMin = -0.7853981633974483;
  102.       this.cannonAngleMax = 0.17453292519943295;
  103.       this.bAutoAim = true;
  104.       this.aCannonPos = new Array();
  105.       this.aCannonPos[0] = new flash.geom.Point(-15,-50);
  106.       this.aCannonPos[3] = new flash.geom.Point(0,-50);
  107.       this.aCannonPos[6] = new flash.geom.Point(15,-50);
  108.       this.aTopPos = new Array();
  109.       this.aTopPos[0] = new flash.geom.Point(49,19);
  110.       this.aTopPos[1] = new flash.geom.Point(59,19);
  111.       this.aTopPos[2] = new flash.geom.Point(65,19);
  112.       this.aTopPos[3] = new flash.geom.Point(65,19);
  113.       this.aTopPos[4] = new flash.geom.Point(65,19);
  114.       this.aTopPos[5] = new flash.geom.Point(72,19);
  115.       this.aTopPos[6] = new flash.geom.Point(84,19);
  116.       this.rope = new Rope(this);
  117.       this.ropePos = new flash.geom.Point(0,-24);
  118.       this.refGame.setFuelGauge(this.fuel);
  119.       this.refGame.setChafsGauge(this.chafs);
  120.       this.refGame.setOnBoardGauge(0,this.maxLoad);
  121.       this.aBottom = new Array();
  122.       this.aBottom[0] = {x0:-22,x1:2};
  123.       this.aBottom[3] = {x0:-12,x1:12};
  124.       this.aBottom[6] = {x0:-2,x1:22};
  125.    }
  126.    function getPosition(Void)
  127.    {
  128.       return this.position.clone();
  129.    }
  130.    function getScreenPos(Void)
  131.    {
  132.       return this.screenPos.clone();
  133.    }
  134.    function getVelocity(Void)
  135.    {
  136.       return this.speed.clone();
  137.    }
  138.    function step(aTargets, aPlatforms)
  139.    {
  140.       if(this.bDestroyed)
  141.       {
  142.          return undefined;
  143.       }
  144.       this.keyControl();
  145.       if(this.bOnPlatform)
  146.       {
  147.          this.acc.x = 0;
  148.       }
  149.       this.bOnPlatform = false;
  150.       if(this.rope.bHasCargo)
  151.       {
  152.          var _loc7_ = this.rope.refCargo.weightFactor;
  153.          if(_loc7_ > 1 && this.rope.length >= 50)
  154.          {
  155.             this.acc.y -= 0.1;
  156.             this.acc.x /= _loc7_;
  157.             this.acc.y /= _loc7_;
  158.          }
  159.       }
  160.       if(this.fuel > 0)
  161.       {
  162.          if(!this.bGodMode)
  163.          {
  164.             this.fuel -= 0.05;
  165.             if(this.fuel < 30 && !this.bFuelSnd)
  166.             {
  167.                this.bFuelSnd = true;
  168.                Sounds.playSound("warning_alarm",99999);
  169.             }
  170.             else if(this.fuel > 30 && this.bFuelSnd)
  171.             {
  172.                this.bFuelSnd = false;
  173.                Sounds.stopSound("warning_alarm");
  174.             }
  175.          }
  176.       }
  177.       else
  178.       {
  179.          this.acc.y = -0.2;
  180.       }
  181.       this.refGame.setFuelGauge(this.fuel);
  182.       if(this.bTurn || this.frame != 0 && this.frame != 3 && this.frame != 6)
  183.       {
  184.          if(this.turnDelay-- < 0)
  185.          {
  186.             this.frame += this.turnDir;
  187.             this.turnDelay = 1;
  188.             if(this.frame <= 0)
  189.             {
  190.                this.frame = 0;
  191.                if(!this.bTurn)
  192.                {
  193.                   this.bTurn = false;
  194.                }
  195.             }
  196.             else if(this.frame >= 6)
  197.             {
  198.                this.frame = 6;
  199.                if(!this.bTurn)
  200.                {
  201.                   this.bTurn = false;
  202.                }
  203.             }
  204.          }
  205.       }
  206.       var _loc2_ = new flash.geom.Point();
  207.       _loc2_.x = this.position.x;
  208.       _loc2_.y = this.position.y - 25;
  209.       switch(this.frame)
  210.       {
  211.          case 0:
  212.             _loc2_.x -= 15 * Math.cos(- this.rotation);
  213.             _loc2_.y += 15 * Math.sin(- this.rotation);
  214.             break;
  215.          case 6:
  216.             _loc2_.x += 15 * Math.cos(this.rotation);
  217.             _loc2_.y += 15 * Math.sin(this.rotation);
  218.       }
  219.       if(this.bAutoAim)
  220.       {
  221.          var _loc8_ = this.findNearest(aTargets,true);
  222.          if(_loc8_ != null)
  223.          {
  224.             var _loc9_ = _loc8_.getPosition();
  225.             var _loc11_ = _loc9_.x - _loc2_.x;
  226.             var _loc10_ = _loc9_.y - _loc2_.y;
  227.             var _loc13_ = Math.atan2(_loc10_,_loc11_);
  228.             this.cannonAngle = _loc13_ - this.rotation;
  229.             if(this.frame == 6)
  230.             {
  231.                if(this.cannonAngle > this.cannonAngleMax)
  232.                {
  233.                   this.cannonAngle = this.cannonAngleMax;
  234.                }
  235.                else if(this.cannonAngle < this.cannonAngleMin)
  236.                {
  237.                   this.cannonAngle = this.cannonAngleMin;
  238.                }
  239.             }
  240.             else if(this.frame == 0)
  241.             {
  242.                if(this.cannonAngle > 0 && this.cannonAngle < 3.141592653589793 - this.cannonAngleMax)
  243.                {
  244.                   this.cannonAngle = 3.141592653589793 - this.cannonAngleMax;
  245.                }
  246.                else if(this.cannonAngle < 0 && this.cannonAngle > -3.141592653589793 - this.cannonAngleMin)
  247.                {
  248.                   this.cannonAngle = -3.141592653589793 - this.cannonAngleMin;
  249.                }
  250.             }
  251.          }
  252.          else
  253.          {
  254.             this.cannonAngle = this.frame != 6 ? 3.141592653589793 : 0;
  255.          }
  256.       }
  257.       var _loc3_ = this.rotation + this.cannonAngle;
  258.       if(this.frame == 0)
  259.       {
  260.          _loc3_ = this.rotation + this.cannonAngle;
  261.       }
  262.       if(this.bShot && (this.frame == 0 || this.frame == 6 || this.frame == 3))
  263.       {
  264.          if(this.shotDelay-- < 0)
  265.          {
  266.             this.shotDelay = 3;
  267.             var _loc14_ = true;
  268.             var _loc5_ = new flash.geom.Point(0,0);
  269.             var _loc4_ = 13;
  270.             switch(this.frame)
  271.             {
  272.                case 0:
  273.                   _loc5_ = new flash.geom.Point(_loc4_ * Math.cos(_loc3_),_loc4_ * Math.sin(_loc3_));
  274.                   _loc2_.y -= Math.round(4 * Math.random());
  275.                   break;
  276.                case 3:
  277.                   _loc5_ = new flash.geom.Point(0,- _loc4_);
  278.                   break;
  279.                case 6:
  280.                   _loc5_ = new flash.geom.Point(_loc4_ * Math.cos(_loc3_),_loc4_ * Math.sin(_loc3_));
  281.                   _loc2_.y -= Math.round(4 * Math.random());
  282.             }
  283.             _loc5_.x += this.speed.x;
  284.             this.refGame.createShot(_loc14_,_loc2_,_loc5_);
  285.          }
  286.       }
  287.       if(this.chafDelay-- < 0)
  288.       {
  289.          this.chafDelay = 0;
  290.       }
  291.       if(this.bChaf && this.chafDelay == 0 && this.chafs > 0)
  292.       {
  293.          this.chafDelay = 10;
  294.          this.chafs = this.chafs - 1;
  295.          this.refGame.setChafsGauge(this.chafs);
  296.          var _loc12_ = this.position.clone();
  297.          var _loc6_ = new flash.geom.Point();
  298.          if(this.speed.x == 0)
  299.          {
  300.             this.speed.x = 4.9e-324;
  301.          }
  302.          if(this.speed.y == 0)
  303.          {
  304.             this.speed.y = 4.9e-324;
  305.          }
  306.          _loc6_.x = (- (0 + 1 * Math.random())) * Math.abs(this.speed.x) / this.speed.x;
  307.          _loc6_.y = (- (0 + 1 * Math.random())) * Math.abs(this.speed.y) / this.speed.y;
  308.          this.refGame.createChaf(_loc12_,_loc6_);
  309.       }
  310.       this.backFrame = this.backFrame + 1;
  311.       this.backFrame %= 7;
  312.       this.topFrame = this.topFrame + 1;
  313.       this.topFrame %= 14;
  314.       this.acc.y -= Game.gravity;
  315.       this.speed.x += this.acc.x;
  316.       this.speed.y += this.acc.y;
  317.       this.speed.x *= this.airDrag;
  318.       this.speed.y *= this.airDrag;
  319.       this.position.x += this.speed.x;
  320.       this.position.y += this.speed.y;
  321.       if(this.position.x < 0)
  322.       {
  323.          this.position.x = 0;
  324.          this.speed.x -= this.speed.x * 0.1;
  325.       }
  326.       else if(this.position.x > this.refGame.levelWidth)
  327.       {
  328.          this.position.x = this.refGame.levelWidth;
  329.          this.speed.x -= this.speed.x * 0.1;
  330.       }
  331.       if(this.position.y < 50)
  332.       {
  333.          this.position.y = 50;
  334.          this.die();
  335.       }
  336.       else if(this.position.y > 340)
  337.       {
  338.          this.position.y = 340;
  339.          this.speed.y = 0;
  340.       }
  341.       this.rotation = -12.566370614359172 * this.speed.x / 180;
  342.       if(this.rotation > this.maxRot)
  343.       {
  344.          this.rotation = this.maxRot;
  345.       }
  346.       else if(this.rotation < - this.maxRot)
  347.       {
  348.          this.rotation = - this.maxRot;
  349.       }
  350.       var _loc15_ = new flash.geom.Point(24 * Math.sin(this.rotation),-24 * Math.cos(this.rotation));
  351.       this.ropeEndPos = this.rope.step(this.position.add(_loc15_),this.speed);
  352.       this.checkPlatforms(aPlatforms);
  353.       if(!this.bOnPlatform)
  354.       {
  355.          if(this.checkCollision())
  356.          {
  357.             this.die();
  358.          }
  359.       }
  360.    }
  361.    function draw(levelWidth)
  362.    {
  363.       if(!this.bDestroyed)
  364.       {
  365.          this.bmpTmp.fillRect(this.bmpTmp.rectangle,0);
  366.          if(this.frame == 0)
  367.          {
  368.             this.drawTopRot(this.aTopPos[this.frame]);
  369.             this.drawChopper();
  370.             this.drawBackRot();
  371.          }
  372.          else if(this.frame == 6)
  373.          {
  374.             this.drawBackRot();
  375.             this.drawTopRot(this.aTopPos[this.frame]);
  376.             this.drawChopper();
  377.          }
  378.          else
  379.          {
  380.             this.drawTopRot(this.aTopPos[this.frame]);
  381.             this.drawChopper();
  382.          }
  383.          var _loc3_ = new flash.geom.Matrix();
  384.          _loc3_.translate((- this.bmpTmp.width) / 2,(- this.bmpTmp.height) / 2);
  385.          var _loc5_ = new flash.geom.Matrix();
  386.          _loc5_.rotate(- this.rotation);
  387.          _loc3_.concat(_loc5_);
  388.          var _loc13_ = this.bmpTmp.width;
  389.          var _loc11_ = this.bmpTmp.height;
  390.          var _loc2_ = Game.screenW * 0.5;
  391.          if(this.position.x < Game.screenW * 0.5)
  392.          {
  393.             _loc2_ = this.position.x;
  394.          }
  395.          else if(this.position.x > levelWidth - Game.screenW * 0.5)
  396.          {
  397.             _loc2_ *= 2;
  398.             _loc2_ -= levelWidth - this.position.x;
  399.          }
  400.          var _loc4_ = new flash.geom.Matrix();
  401.          _loc4_.translate(_loc2_,this.screenH - this.position.y);
  402.          _loc3_.concat(_loc4_);
  403.          var _loc7_ = null;
  404.          var _loc6_ = "normal";
  405.          var _loc8_ = null;
  406.          var _loc10_ = true;
  407.          this.screenPos.y = this.position.y;
  408.          this.screenPos.x = _loc2_;
  409.          this.bmpCanvas.draw(this.bmpTmp,_loc3_,_loc7_,_loc6_,_loc8_,_loc10_);
  410.          if(this.bShowExplosion)
  411.          {
  412.             this.drawExplosion(this.screenPos,false);
  413.          }
  414.          var _loc9_ = new flash.geom.Point(24 * Math.sin(this.rotation),-24 * Math.cos(this.rotation));
  415.          this.rope.draw(this.screenPos.add(_loc9_));
  416.       }
  417.       else
  418.       {
  419.          this.drawExplosion(this.screenPos,true);
  420.       }
  421.    }
  422.    function drawBackRot(Void)
  423.    {
  424.       var _loc3_ = new flash.geom.Rectangle(0,23 * this.backFrame,23,23);
  425.       var _loc2_ = new flash.geom.Point();
  426.       if(this.frame == 0)
  427.       {
  428.          _loc2_.x = 105;
  429.          _loc2_.y = 0;
  430.       }
  431.       else if(this.frame == 6)
  432.       {
  433.          _loc2_.x = 1;
  434.          _loc2_.y = 0;
  435.       }
  436.       this.bmpTmp.copyPixels(this.bmpBackRot,_loc3_,_loc2_,null,null,true);
  437.    }
  438.    function drawTopRot(pos)
  439.    {
  440.       pos = new flash.geom.Point(65,15);
  441.       if(this.topFrame % 2 == 0)
  442.       {
  443.          var _loc3_ = new flash.geom.Point(pos.x - this.bmpTopRot.width / 2,pos.y - this.bmpTopRot.height);
  444.          this.bmpTmp.copyPixels(this.bmpTopRot,this.bmpTopRot.rectangle,_loc3_,null,null,true);
  445.       }
  446.    }
  447.    function drawChopper(Void)
  448.    {
  449.       if(this.bShowWheels)
  450.       {
  451.          if(this.frameWheels < 6)
  452.          {
  453.             this.frameWheels += 2;
  454.          }
  455.          var _loc2_ = new flash.geom.Rectangle(0,10 * Math.round(this.frame / 3),130,10);
  456.          var _loc3_ = new flash.geom.Point(0,41 + this.frameWheels);
  457.          this.bmpTmp.copyPixels(this.bmpWheels,_loc2_,_loc3_,null,null,true);
  458.       }
  459.       else if(this.frameWheels > 0)
  460.       {
  461.          if(this.frame % 3 != 0)
  462.          {
  463.             this.frameWheels = 0;
  464.          }
  465.          _loc2_ = new flash.geom.Rectangle(0,10 * Math.round(this.frame / 3),130,10);
  466.          _loc3_ = new flash.geom.Point(0,41 + this.frameWheels);
  467.          this.bmpTmp.copyPixels(this.bmpWheels,_loc2_,_loc3_,null,null,true);
  468.          this.frameWheels -= 2;
  469.       }
  470.       _loc2_ = new flash.geom.Rectangle(0,53 * this.frame,130,53);
  471.       _loc3_ = new flash.geom.Point(0,0);
  472.       this.bmpTmp.copyPixels(this.bmpChopper,_loc2_,_loc3_,null,null,true);
  473.    }
  474.    function drawExplosion(pos, bRemove)
  475.    {
  476.       var _loc3_ = _root.attachMovie("explosion0","mcExp",_root.getNextHighestDepth());
  477.       _loc3_.gotoAndStop(this.frameExp + 1);
  478.       var _loc4_ = new flash.geom.Matrix();
  479.       _loc4_.translate(pos.x,Game.screenH - pos.y);
  480.       this.bmpCanvas.draw(_loc3_,_loc4_,null,null,null,true);
  481.       _loc3_.removeMovieClip();
  482.       this.frameExp = this.frameExp + 1;
  483.       if(this.frameExp == 35)
  484.       {
  485.          if(bRemove)
  486.          {
  487.             this.onEndDeadAnim();
  488.          }
  489.          else
  490.          {
  491.             this.bShowExplosion = false;
  492.          }
  493.       }
  494.    }
  495.    function keyControl(Void)
  496.    {
  497.       var _loc3_ = 38;
  498.       var _loc7_ = 40;
  499.       var _loc4_ = 37;
  500.       var _loc6_ = 39;
  501.       var _loc2_ = 67;
  502.       var _loc9_ = 88;
  503.       var _loc5_ = 90;
  504.       var _loc8_ = 32;
  505.       this.acc.y = 0;
  506.       if(Key.isDown(_loc3_))
  507.       {
  508.          this.acc.y += 0.25;
  509.          if(this.acc.y > this.accMax.y)
  510.          {
  511.             this.acc.y = this.accMax.y;
  512.          }
  513.       }
  514.       else if(Key.isDown(_loc7_))
  515.       {
  516.          this.acc.y -= 0.25;
  517.          if(this.acc.y < - this.accMax.y)
  518.          {
  519.             this.acc.y = - this.accMax.y;
  520.          }
  521.       }
  522.       this.acc.x = 0;
  523.       if(!this.bOnPlatform)
  524.       {
  525.          if(Key.isDown(_loc4_))
  526.          {
  527.             this.acc.x = -0.3;
  528.             if(!this.bShot && (!this.bTurn || this.turnDir == 1))
  529.             {
  530.                this.bTurn = true;
  531.                this.turnDir = -1;
  532.                this.turnDelay = 0;
  533.             }
  534.          }
  535.          else if(Key.isDown(_loc6_))
  536.          {
  537.             this.acc.x = 0.3;
  538.             if(!this.bShot && (!this.bTurn || this.turnDir == -1))
  539.             {
  540.                this.bTurn = true;
  541.                this.turnDir = 1;
  542.                this.turnDelay = 0;
  543.             }
  544.          }
  545.          else
  546.          {
  547.             this.bTurn = false;
  548.          }
  549.       }
  550.       if(Key.isDown(_loc5_))
  551.       {
  552.          this.bChaf = true;
  553.       }
  554.       else
  555.       {
  556.          this.bChaf = false;
  557.       }
  558.       if(Key.isDown(_loc2_) && !this.bShot)
  559.       {
  560.          this.bShot = true;
  561.          Sounds.playSound("ak47",99999);
  562.       }
  563.       else if(!Key.isDown(_loc2_) && this.bShot)
  564.       {
  565.          this.bShot = false;
  566.          Sounds.stopSound("ak47");
  567.       }
  568.       if(Key.isDown(_loc8_) && this.aHostTaken.length < this.maxLoad)
  569.       {
  570.          if(!this.bRopePress)
  571.          {
  572.             this.bRopePress = true;
  573.             this.rope.switchMode();
  574.          }
  575.       }
  576.       else
  577.       {
  578.          this.bRopePress = false;
  579.       }
  580.    }
  581.    function getDamage(damage)
  582.    {
  583.       this.energy -= damage;
  584.       if(this.energy <= 0)
  585.       {
  586.          this.die();
  587.       }
  588.       else
  589.       {
  590.          this.frameExp = 0;
  591.          this.bShowExplosion = true;
  592.       }
  593.    }
  594.    function die(Void)
  595.    {
  596.       if(this.bGodMode)
  597.       {
  598.          return undefined;
  599.       }
  600.       Sounds.stopSound("CHOPPER2");
  601.       Sounds.playSound("bazooka");
  602.       this.bDestroyed = true;
  603.       this.frameExp = 0;
  604.       Game.getInstance().removeHostage(this.rope.refCargo);
  605.       if(this.rope.refCargo.sType == "vehicle")
  606.       {
  607.          this.rope.switchMode();
  608.       }
  609.    }
  610.    function findNearest(aObjects, bInFront)
  611.    {
  612.       var _loc11_ = aObjects.length;
  613.       var _loc8_ = 1.7976931348623157e+308;
  614.       var _loc6_ = 1.7976931348623157e+308;
  615.       var _loc10_ = null;
  616.       var _loc9_ = null;
  617.       var _loc2_ = 0;
  618.       while(_loc2_ < _loc11_)
  619.       {
  620.          if(aObjects[_loc2_].bOnScreen)
  621.          {
  622.             var _loc4_ = aObjects[_loc2_].getPosition();
  623.             var _loc7_ = _loc4_.subtract(this.position);
  624.             var _loc3_ = _loc7_.length;
  625.             if(_loc3_ < _loc8_)
  626.             {
  627.                _loc8_ = _loc3_;
  628.                _loc10_ = aObjects[_loc2_];
  629.             }
  630.             if(this.frame == 0 && _loc4_.x < this.position.x && _loc3_ < _loc6_ || this.frame == 6 && _loc4_.x > this.position.x && _loc3_ < _loc6_)
  631.             {
  632.                _loc6_ = _loc3_;
  633.                _loc9_ = aObjects[_loc2_];
  634.             }
  635.          }
  636.          _loc2_ = _loc2_ + 1;
  637.       }
  638.       return !bInFront ? _loc10_ : _loc9_;
  639.    }
  640.    function increaseLoad(id, index)
  641.    {
  642.       this.aHostTaken.push({id:id,index:index});
  643.       this.refGame.setOnBoardGauge(this.aHostTaken.length,this.maxLoad);
  644.       if(this.aHostTaken.length >= this.maxLoad)
  645.       {
  646.          this.refGame.mcAlert.gotoAndPlay("show");
  647.       }
  648.    }
  649.    function onEndDeadAnim(Void)
  650.    {
  651.       this.refGame.onLooseLife();
  652.    }
  653.    function checkCollision(Void)
  654.    {
  655.       var _loc1_ = new flash.geom.Point(0,0);
  656.       return Game.bmpDead.hitTest(_loc1_,50,Game.bmpChopper,_loc1_,254);
  657.    }
  658.    function checkPlatforms(aPlatforms)
  659.    {
  660.       this.bOnPlatform = false;
  661.       var _loc7_ = aPlatforms.length;
  662.       var _loc10_ = 40;
  663.       var _loc9_ = this.height;
  664.       var _loc4_ = 0;
  665.       while(_loc4_ < _loc7_)
  666.       {
  667.          var _loc2_ = aPlatforms[_loc4_];
  668.          if(_loc2_.bOnScreen)
  669.          {
  670.             var _loc3_ = undefined;
  671.             if(this.frame != 0 && this.frame != 3 && this.frame != 6)
  672.             {
  673.                _loc3_ = this.aBottom[3];
  674.             }
  675.             else
  676.             {
  677.                _loc3_ = this.aBottom[this.frame];
  678.             }
  679.             var _loc6_ = this.position.x + _loc3_.x0;
  680.             var _loc5_ = this.position.x + _loc3_.x1;
  681.             if(_loc2_.plaPos.x < _loc6_ && _loc2_.plaPos.x + _loc2_.plaWidth > _loc5_ && this.position.y > _loc2_.plaPos.y)
  682.             {
  683.                if(this.position.y - _loc2_.plaPos.y < this.height / 2 + 2)
  684.                {
  685.                   if(!this.bShowWheels)
  686.                   {
  687.                      this.bShowWheels = true;
  688.                      this.frameWheels = 0;
  689.                   }
  690.                   if(this.speed.length < 2)
  691.                   {
  692.                      if(this.acc.y <= 0)
  693.                      {
  694.                         this.speed.x = 0;
  695.                         this.speed.y = 0;
  696.                         this.rotation = 0;
  697.                         this.position.y = 1 + _loc2_.plaPos.y + this.height / 2;
  698.                      }
  699.                      this.bOnPlatform = true;
  700.                      this.refGame.actionOnPlatform(_loc2_.sType,_loc2_.position);
  701.                      break;
  702.                   }
  703.                }
  704.                else if(this.position.y - _loc2_.plaPos.y < this.height / 2 + 3)
  705.                {
  706.                   if(!this.bShowWheels)
  707.                   {
  708.                      this.bShowWheels = true;
  709.                      this.frameWheels = 0;
  710.                   }
  711.                }
  712.                else
  713.                {
  714.                   this.bShowWheels = false;
  715.                }
  716.             }
  717.          }
  718.          _loc4_ = _loc4_ + 1;
  719.       }
  720.    }
  721. }
  722.